package assist.datastore.dao;


/**
 * Abstract DAOFactory, as per 
 * http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
 * 
 * The above link provides example of providing different DAOs for different
 * datasources. For now, we are just using this pattern to provide the 
 * DAOFactory interface and hard-coding the actual DAO Factory to return here.
 * 
 * We will start by building a JDO/GAE datasource DAOFactory.  Then we will
 * convert it to a ObjectifyDAOFactory.
 * 
 * NOTE: For inheritence hierarchies, we are using the 
 * <a href="http://martinfowler.com/eaaCatalog/concreteTableInheritance.html">
 * Concrete Table Inheritance Pattern </a>.  So every concrete class in the
 * hierarchy has its own DAO, and needs its own table.
 */
public abstract class DAOFactory 
{
  // There will be a method for each DAO that can be 
  // created, which is one for every Domain object.
  // NOTE: There are EntityDAOs that retrieve from the datastore, as well as
  // DAOs that are just composed of Entities, but can still be retrieved/stored
  // through a DAO interface. 
  public abstract GameDAO getGameDAO();
  public abstract PlayerDAO getPlayerDAO();
  public abstract ShotOnGoalDAO getShotOnGoalDAO();
  public abstract BlockedShotDAO getBlockedShotDAO();
  public abstract MissedShotDAO getMissedShotDAO();
  public abstract GoalDAO getGoalDAO();
  public abstract ShotDAO getShotDAO();
  public abstract TeamDAO getTeamDAO();
  //Called from testing environments to reset underlying datasources.
  public abstract void reset();

  public static DAOFactory getDAOFactory() 
  {  
      return new JDODAOFactory();
  }
}
